﻿
/*构造器重载*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp_constructor
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //创建实例，为默认
            Student student = new Student();
            // () 是调用 构造器
            Console.WriteLine(student.ID);
            Console.WriteLine(student.Name);


            Console.WriteLine("==================");

            //键入值创建实例
            Student student2 = new Student(2, "Hello");
            Console.WriteLine(student2.ID);
            Console.WriteLine(student2.Name);
        }
    }

    class Student
    {
        public Student()
        {
            this.ID = 1;
            this.Name = "No Name";
        }

        public Student(int intId, string intName)
        {
            this.ID = intId;
            this.Name = intName;
        }


        public int ID;
        public string Name;
    }
}
